#include "contactsmodel.h"
#include "cprofile.h"

// for doxygen

CProfile::CProfile(const CAuthInfo &authInfo, IProfile *parent)  :
        QObject(parent), m_authInfo(authInfo),
        m_contactsModel(new ContactsModel(this))
{
    m_state = NotConnected;
    m_error = NoError;

    m_profileInfo = ContactInfo(authInfo.user() + "@" + authInfo.host(), networkId());
}

QString CProfile::networkId() const
{
    return m_authInfo.networkId();
}

CAuthInfo CProfile::authInfo() const
{
    return m_authInfo;
}

ContactsModel * CProfile::contactsModel() const
{
    return m_contactsModel;
}

CProfile::State CProfile::state() const
{
    return m_state;
}

void CProfile::setState(State state)
{
    m_state = state;
    emit stateChanged(state);
}

CProfile::Error CProfile::error() const
{
    return m_error;
}

void CProfile::setError(Error error)
{
    m_error = error;
    emit errorChanged(error);
}
